﻿using System.Collections.Generic;
using facebook.Schema;
using System.IO;

namespace facebook
{
	/// <summary>
	/// Facebook application api methods.
	/// </summary>
	public class video
	{
		private readonly API _api;
		/// <summary>
		/// Public constructor for facebook.video
		/// </summary>
		/// <param name="parent">Needs a connected API object for making requests</param>
		public video(API parent)
		{
			_api = parent;
		}

		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
        public video_limits getUploadLimits()
		{
			var parameterList = new Dictionary<string, string> { { "method", "facebook.video.getUploadLimits" } };

			var response = _api.SendRequest(parameterList, true);
			return !string.IsNullOrEmpty(response) ? video_getUploadLimits_response.Parse(response).Content : null;
		}
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public facebook.Schema.video upload(string title, string description, FileInfo data)
        {
            var parameterList = new Dictionary<string, string> { { "method", "facebook.video.upload" } };
            _api.AddOptionalParameter(parameterList, "title", title);
            _api.AddOptionalParameter(parameterList, "description", description);

            var response = _api.ExecuteApiVideoUpload(data, parameterList);
            return !string.IsNullOrEmpty(response) ? video_upload_response.Parse(response).Content : null;
        }
    }
}
